/* 用来提供给用户定制组件样式的 mixin api */
/* param等于default，则使用默认样式 */

/**
 * 设置弹框的字体颜色，背景色，高度
 * @param $textColor
 * @param $bgColor
 * @param $height
 */
@mixin setDialogHead($textColor, $bgColor, $height) {
    .jigsaw-dialog {
        .jigsaw-dialog-head {
            @if ($textColor != default) {
                color: $textColor;
            }
            @if ($bgColor != default) {
                background: $bgColor;
            }
            @if ($height != default) {
                padding: {
                    top: 0;
                    bottom: 0;
                }
                height: $height;
                line-height: $height;
            }
        }
    }
}

/**
 * 设置弹框的按钮位置，是否显示分隔线
 * @param $buttonAlign 默认center
 * @param $showButtonLine 默认true
 */
@mixin setDialogButton($buttonAlign: center, $showButtonLine: true) {
    .jigsaw-dialog {
        .jigsaw-dialog-button-group {
            @if ($buttonAlign != default) {
                text-align: $buttonAlign;
            }
            border-top: 1px solid if($showButtonLine, $border-color-base, transparent);
        }
    }
}

/**
 * 设置按钮动画的开关
 * @param $withAnimation 默认true
 */
@mixin showBtnAnimation($withAnimation: true) {
    .#{$btn-prefix-cls}.#{$btn-prefix-cls}-clicked:after {
        content: if($withAnimation, '', none);
    }
}

/**
 * 设置checkbox的背景色和inner的颜色
 * @param $checkedBgColor
 * @param $checkedInnerColor
 */
@mixin setCheckbox($checkedBgColor, $checkedInnerColor) {
    .jigsaw-checkbox-host {
        .jigsaw-checkbox-wrapper .jigsaw-checkbox-checked, .jigsaw-checkbox-wrapper .jigsaw-checkbox-indeterminate {
            @if ($checkedBgColor != default) {
                background-color: $checkedBgColor;
            }
        }
        .jigsaw-checkbox-wrapper .jigsaw-checkbox-checked:after {
            @if ($checkedInnerColor != default) {
                border-color: $checkedInnerColor;
            }
        }
    }
}

/**
 * 设置表格背景色，字体颜色，字体大小，下边线颜色，下边线宽度
 * @param $bgColor
 * @param $textColor
 * @param $fontSize
 * @param $borderBottomColor
 * @param $borderBottomWidth
 */
@mixin setTableHead($bgColor, $textColor, $fontSize, $borderBottomColor, $borderBottomWidth) {
    .jigsaw-table-host table {
        thead {
            @if ($textColor != default) {
                color: $textColor;
            }
            @if ($fontSize != default) {
                font-size: $fontSize;
            }
            tr td {
                @if ($bgColor != default) {
                    background: $bgColor;
                }
                @if ($borderBottomWidth != default) {
                    border-bottom-width: $borderBottomWidth;
                }
                @if ($borderBottomColor != default) {
                    border-bottom-color: $borderBottomColor;
                }
            }
        }
    }
}

/**
 * 设置表格表体的字体颜色，字体大小，奇数行背景色，偶数行背景色
 * @param $textColor
 * @param $fontSize
 * @param $oddRowBgColor
 * @param $evenRowBgColor
 */
@mixin setTableBody($textColor, $fontSize, $oddRowBgColor, $evenRowBgColor) {
    .jigsaw-table-host table {
        tbody {
            @if ($textColor != default) {
                color: $textColor;
            }
            @if ($fontSize != default) {
                font-size: $fontSize;
            }
        }
        tbody tr:nth-child(2n) {
            @if ($evenRowBgColor != default) {
                background: $evenRowBgColor;
            }
        }
        tbody tr:nth-child(2n-1) {
            @if ($oddRowBgColor != default) {
                background: $oddRowBgColor;
            }
        }
    }
}

/**
 * 设置表格单元格文字对齐方式，及左对齐或右对齐时距离边线的边距
 * @param $textAlign 默认center
 * @param $sidePadding 默认0
 */
@mixin setTableTextAlign($textAlign: center, $sidePadding: 0) {
    .jigsaw-table-host table {
        td {
            @if ($textAlign != default) {
                text-align: $textAlign;
            }
            @if ($textAlign == left) {
                padding: 0 $sidePadding;
            } @else if ($textAlign == right) {
                padding: 0 $sidePadding;
            }
        }
    }
}

/**
 * 设置tag的默认背景色，高度
 * @param $defaultBgColor
 * @param $height
 * @param
 */
@mixin setTag($defaultBgColor, $height) {
    .jigsaw-tag-host {
        @if ($defaultBgColor != default) {
            background: $defaultBgColor;
        }
        @if ($height != dafault) {
            height: $height;
            line-height: $height - 2;
            .#{$tag-prefix-cls}-close-bar {
                line-height: $height - 3;
            }
        }
    }
}

/**
 * 设置collapse头部背景色
 * @param $headBgColor
 */
@mixin setCollapse($headBgColor) {
    .jigsaw-collapse-host .jigsaw-collapse-item .jigsaw-collapse-header {
        background: $headBgColor;
    }
}

/**
 * 设置是否显示tab-line下的三角
 * @param $showTriangle 默认true
 */
@mixin setTabTriangle($showTriangle: true) {
    .jigsaw-tabs {
        .jigsaw-tabs-nav-container .jigsaw-tabs-ink-bar:after {
            display: if($showTriangle, block, none);
        }
    }
}

